package br.net.woodstock.tickettoride.web.seam.manager;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.core.Conversation;

import br.net.woodstock.tickettoride.api.access.UserService;
import br.net.woodstock.tickettoride.api.manager.ApplicationService;
import br.net.woodstock.tickettoride.web.jsf.manager.common.AbstractApplicationBean;

@Name("applicationBean")
@Scope(ScopeType.CONVERSATION)
public class ApplicationBean extends AbstractApplicationBean {

	private static final long	serialVersionUID	= 2488493041210299233L;

	@In("#{applicationService}")
	private ApplicationService	applicationService;

	@In("#{userService}")
	private UserService			userService;

	@In
	private Conversation		conversation;

	@Override
	public ApplicationService getApplicationService() {
		return this.applicationService;
	}

	@Override
	public UserService getUserService() {
		return this.userService;
	}

	@Override
	protected void onStart() {
		this.conversation.begin();
	}

	@Override
	protected void onEnd() {
		this.conversation.end(true);
	}

}
